package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface SetmealDao {

    void setcheckgroupandsetmeal(Map<String, Integer> map);

    void add(Setmeal setmeal);

    Page<Setmeal> selectByCondition(String queryString);

    List<Setmeal> getAllSetmeal();

    @Select("select * from t_setmeal where id=#{id}")
    @Results({
                    @Result(id=true,property = "id",column = "id"),
                    @Result(property = "name",column = "name"),
                    @Result( column="code",property="code"),
                    @Result(column="helpCode" ,property="helpCode"),
                    @Result(column="sex", property="sex"),
                    @Result(column="age", property="age"),
                    @Result(column="price", property="price"),
                    @Result(column="remark" ,property="remark"),
                    @Result(column="attention", property="attention") ,
                    @Result(column="img" ,property="img"),
                    @Result(property = "checkGroups",column = "id",
                    javaType = List.class,
                    many = @Many(select = "com.itheima.dao.CheckGroupDao.findCheckGroupId"))
            })
    Setmeal findById(Integer id);

    List<Map<String,Object>> findByNameAndID();

    List<String> findAllSetmeal();

    List<Map<Object,Object>> findSetmealPriceAndId();

    String findNameById(Integer id);
    @Select("select * from t_setmeal where id=#{id}")
    Setmeal findSetmealById(Integer setmealId);
}
